package com.bristua.common.enums;

import java.text.MessageFormat;

public enum WXApiFormat {
	TOKEN_URL("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}"),

	USER_INFO_URL("https://api.weixin.qq.com/cgi-bin/user/info?access_token={0}&openid={1}&lang=zh_CN"),
	
	CEATE_QRCODE("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token={0}"),

	CUSTOMER_MSG_URL("https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={0}"),

	//微信小程序API 登录
	OPENID_URL ("https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type=authorization_code"),

	//微信小程序模板推送接口

	MINIPRO_SEND_TEMPLATE_MSG("https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token={0}"),

	OAUTH_URL("https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code");




	private MessageFormat format;

	WXApiFormat(String pattern) {
		this.format = new MessageFormat(pattern);
	}

	public String format(String... params) {
		return format.format(params);
	}

	public MessageFormat getFormat() {
		return format;
	}
}
